//菜单数据
var articletreeStore = Ext.create('Ext.data.TreeStore', {
			autoLoad : true,
			//model : 'colum',
			proxy : {
				actionMethods : {
					read : 'post'
				},
				type : 'ajax',
				//url : 'js/treejson/articletest.json',
				url : '/test/column/columnlist.do',
				reader : {
					type : 'json',
					root : 'columnlist'
					// record: 'node'
				},
				//传参  
				extraParams : {
					parentID : ''
				}
			},
			//sorters : [{
			//			property : 'leaf',
			//			direction : 'ASC'
			//		}],
			root : {
				//nodeType : 'async',
				text : '管理菜单',
				//id: '00',
				expanded : true
			},
			listeners : {
				'beforeexpand' : function(node, eOpts) {
					//点击父亲节点的菜单会将节点的id通过ajax请求，将到后台  
					this.proxy.extraParams.parentID = node.raw.rootid;
				}
			}

		});

//菜单窗体
var articletreenode = Ext.create('Ext.tree.Panel', {
	title : '系统菜单',
	id : 'articletreenode',
	collapsible : true, //自动收缩按钮 
	split : true,
	//border : false,
	store : articletreeStore,
	animate : true,
	autoScroll : true, //如果超出范围带自动滚动条
	width : 225,
	iconCls : "icon-tree",
	//layout : "accordion",
	region : "west",
	border : true, //显示tree side frame
	layoutConfig : {
		animate : true
	},
	rootVisible : false, //是否显示根节点
	containerScroll : true,
	useArrows : true,
	listeners : {
		'itemclick' : function(view, record) {
			var leaf = record.get('leaf');
			var modelData = record.raw;
			if (leaf) {
				//alert('is leaf!');
				//获取节点的data的值
				//alert("asas:"+record.raw.channelID);
				//var id = record.get('id');
				var id = record.raw.channelID;
				if (Ext.getCmp(id)) {
					center.setActiveTab(id);
				} else {
					var parentID = record.raw.parentID;
					if (parentID == 0) {
						n = center.add({

									'id' : record.raw.channelID,
									'title' : "<b>" + record.raw.text + "<b>",
									layout : 'fit',
									autoScroll : true,
									iconCls : "hotelmanageicon"
								});

					}
					n = center.add({

						'id' : record.raw.channelID,
						'title' : record.raw.text,
						closable : true, // 通过html载入目标页 
						layout : 'fit',

						html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="'
								+ record.raw.columnurl + '"></iframe>'
					});
				}

			} else {
				//alert('not leaf!');
				var expand = record.get('expanded');
				//alert(expand);
				if (expand) {
					view.collapse(record);
				} else {
					view.expand(record);
				}
			}
		}
	} //listeners -------funcation end----------
});